#ifndef BALL_COMMON_H
#define BALL_COMMON_H

#ifdef _WIN32
#define BALL_COMPILER_MSVC 1
#endif

#define BALL_BIT(bit)                            (1 << (bit))
#define BALL_BIT_SET(bitset, bit)                ((bitset) |= (1 << (bit)))
#define BALL_BIT_SET_ALL(bitset)                 ((bitset) = -1)
#define BALL_BIT_SET_ALL_TO(bitset, bit)         ((bitset) |= ~(-1 << (bit + 1)))
#define BALL_BIT_SET_ALL_FROM(bitset, bit)       ((bitset) |= (-1 << (bit)))
#define BALL_BIT_CLEAR(bitset, bit)              ((bitset) &= ~(1 << (bit)))
#define BALL_BIT_CLEAR_ALL(bitset)               ((bitset) = 0)
#define BALL_BIT_CLEAR_ALL_TO(bitset, bit)       ((bitset) &= (-1 << (bit + 1)))
#define BALL_BIT_CLEAR_ALL_FROM(bitset, bit)     ((bitset) &= ~(-1 << (bit)))
#define BALL_BIT_IS_SET(bitset, bit)             ((bitset) & (1 << (bit)))
#define BALL_BIT_IS_CLEARED(bitset, bit)         !((bitset) & (1 << (bit)))

#define	F_OK	0
#define	R_OK	4
#define	W_OK	2
#define	X_OK	1

namespace BALL {
	typedef int Size;
	typedef int Index;
	typedef int Position;

	static const Index INVALID_INDEX = -1;
}
#endif